define(['app','cart'],function(app,cart){
	app.controller("dengluctl",['$scope','$http',function($scope,$http){
		$scope.denglu=function(){
			var ajax=new XMLHttpRequest();
			ajax.open('post',"http://127.0.0.1/kadxm/index.php");
			ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			var  inputs=document.getElementsByTagName('input');
			ajax.send('username='+inputs[0].value+"&password="+inputs[1].value);
			ajax.onreadystatechange=function(){
				if(ajax.status==200&&ajax.readyState==4){
					var obj=JSON.parse(ajax.responseText);
					console.log(obj);
					if(obj.code==1){

						window.location.href='../../html/index/index.html';
					}else{
						alert(obj.msg);
					}
				}
			}
		}
		
	}])
})